//
//  ThirdView.m
//  UIComprehensive
//
//  Created by lanou3g on 16/1/25.
//  Copyright © 2016年 徐强. All rights reserved.
//

#import "ThirdView.h"

@implementation ThirdView

-(instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        [self addAllView];
    }
    return self;
    
}
- (void)addAllView{
    self.backgroundColor = [UIColor cyanColor];
#pragma mark - UIScrollView
    self.scrollV = [[UIScrollView alloc]initWithFrame:CGRectMake(50, 50, 300, 500)];
    //这个属性是决定实际大小，就是滑动范围，必须大于frame(宽度大于frame的宽度，就代表能在水平方向上滑动，若小于则不能再对应方向上滑动)
    self.scrollV.contentSize = CGSizeMake(1500, 0);
//    //偏移量（重点）：偏移量可以计算滚动视图的当前位置
//    self.scrollV.contentOffset = CGPointMake(200, 200);
    //水平／竖直滚动条的显示
    self.scrollV.showsHorizontalScrollIndicator = NO;
    self.scrollV.showsVerticalScrollIndicator = YES;
    //滚动指示条的样式
    self.scrollV.indicatorStyle = UIScrollViewIndicatorStyleWhite;
    //设置边界是否有回弹效果 默认为YES
    self.scrollV.bounces = NO;
    //一次滑动为整页大小
    self.scrollV.pagingEnabled = YES;
    //（最大/最小）缩放比例，默认为1
    self.scrollV.maximumZoomScale = 2;
    self.scrollV.minimumZoomScale = 0.2;
    [self addSubview:self.scrollV];
    
    
#warning 简易相册的功能
    self.scroll1 = [[UIScrollView alloc]initWithFrame:self.scrollV.bounds];
    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 300, 500)];
    [self.scroll1 addSubview:imageView];
    self.scroll1.maximumZoomScale = 2 ;
    self.scroll1.minimumZoomScale = 0.5 ;
    imageView.image = [UIImage imageNamed:@"何以0.jpg"];
    [self.scrollV addSubview:self.scroll1];
    
    self.scroll2 = [[UIScrollView alloc]initWithFrame:CGRectMake(300, 0, 300, 500)];
    UIImageView *imageView1 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.scroll1.frame.size.width, self.scroll1.frame.size.height)];
    [self.scroll2 addSubview:imageView1];
    self.scroll2.maximumZoomScale = 2 ;
    self.scroll2.minimumZoomScale = 0.5 ;
    imageView1.image = [UIImage imageNamed:@"16"];
    [self.scrollV addSubview:self.scroll2];
    
    _scroll3 = [[UIScrollView alloc]initWithFrame:CGRectMake(600, 0, 300, 500)];
    UIImageView *imageView2 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.scroll1.frame.size.width, self.scroll1.frame.size.height)];
    [self.scroll3 addSubview:imageView2];
    self.scroll3.maximumZoomScale = 2 ;
    self.scroll3.minimumZoomScale = 0.5 ;
    imageView2.image = [UIImage imageNamed:@"13"];
    [self.scrollV addSubview:_scroll3];
    
    self.scroll4 = [[UIScrollView alloc]initWithFrame:CGRectMake(900, 0, 300, 500)];
    UIImageView *imageView3 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.scroll1.frame.size.width, self.scroll1.frame.size.height)];
    [self.scroll4 addSubview:imageView3];
    self.scroll4.maximumZoomScale = 2 ;
    self.scroll4.minimumZoomScale = 0.5 ;
    imageView3.image = [UIImage imageNamed:@"6.jpg"];
    [self.scrollV addSubview:self.scroll4];
    
    self.scroll5 = [[UIScrollView alloc]initWithFrame:CGRectMake(1200, 0, 300, 500)];
    UIImageView *imageView4 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.scroll1.frame.size.width, self.scroll1.frame.size.height)];
    [self.scroll5 addSubview:imageView4];
    self.scroll5.maximumZoomScale = 2 ;
    self.scroll5.minimumZoomScale = 0.5 ;
    imageView4.image = [UIImage imageNamed:@"23.jpg"];
    [self.scrollV addSubview:self.scroll5];

#pragma mark - UIPageControl
    self.page = [[UIPageControl alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, 50)];
    self.page.backgroundColor = [UIColor cyanColor];
    
    //指示器的页数
    self.page.numberOfPages = 5;
    //未选中点的颜色（点是有序的：从左到右，0开始）
    self.page.pageIndicatorTintColor = [UIColor blackColor];
    //当前选中点的颜色
    self.page.currentPageIndicatorTintColor = [UIColor redColor];
    
    [self addSubview:self.page];
    
}


@end
